namespace XUCore.WeChat.Net.ServerMessages.To
{
    using System;
    using System.Collections.Generic;
    using System.Xml.Serialization;

    /// <summary>
    /// 文章列表
    /// </summary>
    [XmlRoot(ElementName = "xml")]
    public class ToNewsMessage : ToMessageBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ToNewsMessage"/> class.
        /// </summary>
        public ToNewsMessage()
        {
            Type = ToMessageTypes.news;
            Articles = new List<ArticleInfo>();
        }

        /// <summary>
        /// Gets or sets the ArticleCount
        /// 文章数量
        /// </summary>
        [XmlElement("ArticleCount")]
        public int ArticleCount { get; set; }

        /// <summary>
        /// Gets or sets the Articles
        /// 文章列表
        /// </summary>
        [XmlArrayItem("Item")]
        public List<ArticleInfo> Articles { get; set; }

        /// <summary>
        /// Defines the <see cref="ArticleInfo" />
        /// </summary>
        [Serializable]
        public class ArticleInfo
        {
            /// <summary>
            /// Gets or sets the Title
            /// 标题
            /// </summary>
            public string Title { get; set; }

            /// <summary>
            /// Gets or sets the Description
            /// 摘要
            /// </summary>
            public string Description { get; set; }

            /// <summary>
            /// Gets or sets the PicUrl
            /// 图片地址
            /// </summary>
            public string PicUrl { get; set; }

            /// <summary>
            /// Gets or sets the Url
            /// 跳转地址
            /// </summary>
            public string Url { get; set; }
        }
    }
}
